package com.jt.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jt.pojo.User;
import lombok.Data;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.Mapping;

import java.util.List;

@Repository
public interface UserMapper extends BaseMapper<User> {

    //查询全部用户的信息
     public List<User>   findAll();

     @Insert("insert  into  demo_user  values(null,#{name},#{age},#{sex})")
    void insertUsert(User user);

     //修改用户信息的方法
    @Update("update  demo_user  set name=#{newName}  where  name=#{oldName}")
    void updateUser(String oldName, String newName);

    //删除用户的信息的方法
    @Delete("DELETE  FROM demo_user  where id=#{id}")
    void deleteByUserId(Integer  id);

    boolean  insertUserByXml(User user);

}
